package com.yhx.controller;


import com.yhx.pojo.User;
import com.yhx.service.UserClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author uknow
 * @description  使用feign方式调用服务
 * @date 2020/6/13 12:07
 */
@RestController
public class UserClientController {

    @Autowired
    private UserClientService userClientService;

    @RequestMapping("/client/user/queryUser/{id}")
    public User queryUser(@PathVariable("id") Integer id){
        User user = userClientService.queryUser(id);
        return user;
    }

    @RequestMapping("/client/user/queryUsers")
    public List<User> queryUsers(){
        List<User> users = userClientService.queryUsers();
        return users;
    }

    @RequestMapping("/client/user/queryUserByName/{name}")
    public List<User> queryUserByName(@PathVariable("name") String name){
        List<User> users = userClientService.queryUserByName(name);
        return users;
    }
}
